package com.szt.ynb.server.router;

import java.util.List;

import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.szt.ynb.server.router.interceptor.ManageInteceptor;

/***
 * spring mvc 配置
 * 
 * @author wwy
 *
 */
@Configuration
public class SpringMvcConfig extends WebMvcConfigurerAdapter {
	
	@Override
	public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
		
		super.addArgumentResolvers(argumentResolvers);
	}
	
	@Override
	public void addFormatters(FormatterRegistry registry) {
		
		super.addFormatters(registry);
	}
	
	@Override
	public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
		
	}
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(new ManageInteceptor()).addPathPatterns("/manage/**")
				.excludePathPatterns("/manage/main/login");
		super.addInterceptors(registry);
	}
	
	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		registry.addResourceHandler("/**").addResourceLocations("classpath:/static/", "/static/");
		super.addResourceHandlers(registry);
	}
	
}
